************ Footnote 19 --  post-secondary share among emigrants only
**Poland
clear all
import excel using "$path\Output\Compile_Tables.xlsx", sheet("Figs3_B2_B3") cellrange(B4:I8) firstrow
gen level = _n
gen tot = 0
foreach var in inGermany inUSA inIsrael{
	destring `var', replace
	replace tot = tot + `var' if `var' != .
}
qui total tot
replace tot = tot / _b[tot]

qui sum tot in 3
local pol_share = round(r(mean),0.01)
	   
**Hungary
clear all
import excel using "$path\Output\Compile_Tables.xlsx", sheet("Figs3_B2_B3") cellrange(B14:I18) firstrow
gen level = _n
gen tot = 0
foreach var in inGermany inUSA inIsrael{
	destring `var', replace force
	replace tot = tot + `var' if `var' != .
}
qui total tot
replace tot = tot / _b[tot]

qui sum tot in 3
local hun_share = round(r(mean),0.01)


**Romania
import excel using "$path\Output\Compile_Tables.xlsx", sheet("Figs3_B2_B3") cellrange(B24:I28) firstrow clear
gen level = _n
gen tot = 0
foreach var in inGermany inUSA inIsrael{
	destring `var', replace force
	replace tot = tot + `var' if `var' != .
}
qui total tot
replace tot = tot / _b[tot]

qui sum tot in 3
local rom_share = round(r(mean),0.01)


************ End of 6.2 -- relative migration probabilities

*Romania
import excel using "$path\Output\Compile_Tables.xlsx", sheet("Figs3_B2_B3") cellrange(B24:I28) firstrow clear

qui sum Normalized in 4
local rom_prob = round(r(mean),0.01)

*Romania Germans
import excel using "$path\Output\Compile_Tables.xlsx", sheet("Figs3_B2_B3") cellrange(B44:I48) firstrow clear

qui sum Normalized in 4
local rom_german_prob = round(r(mean),0.01)

*Romania Jews
import excel using "$path\Output\Compile_Tables.xlsx", sheet("Figs3_B2_B3") cellrange(B34:I38) firstrow clear

qui sum Normalized in 4
local rom_jew_prob = round(r(mean),0.01)

*Russia
import excel using "$path\Output\Compile_Tables.xlsx", sheet("Figs3_B2_B3") cellrange(B54:I57) firstrow clear

qui sum Normalized in 3
local rus_prob = round(r(mean),0.01)

*Russia Germans
import excel using "$path\Output\Compile_Tables.xlsx", sheet("Figs3_B2_B3") cellrange(B72:I75) firstrow clear

qui sum Normalized in 3
local rus_german_prob = round(r(mean),0.01)

*Russia Jews
import excel using "$path\Output\Compile_Tables.xlsx", sheet("Figs3_B2_B3") cellrange(B63:I66) firstrow clear

qui sum Normalized in 3
local rus_jew_prob = round(r(mean),0.01)



*****************************************************************************************

*** In-text stats all displayed below here

*****************************************************************************************

*Footnote 19
disp "Share of Emigrants with Post-Secondary Education = `pol_share' in Poland, `hun_share' in Hungary, and `rom_share' in Romania."


* End of 6.2
disp "Relative migration rate for tertiary holders compared to post-secondary holders for Romania overall = `rom_prob', for ethnic Germans it is `rom_german_prob', and for Jews it is `rom_jew_prob'. Relative migration rate for tertiary holders compared to upper secondary holders for Russia overall = `rus_prob', for ethnic Germans it is `rus_german_prob', and for Jews it is `rus_jew_prob'."
